/**
 * 用户相关接口
 */

import { LoginReqParams, WxLoginReqParams } from '@/interface/MemberInterface'
import request from './Request'
import {
  LoginResType,
  Res,
  WxLoginResType
} from '@/interface/RequestInterface'

/**
 * @description: 登录用户注册
 * @param {*} params
 * @return {*}
 */
export const login = async (params: LoginReqParams): Promise<Res<LoginResType>> => {
  return request('/member/member/login', {
    method: 'POST',
    data: params
  }) as Promise<Res<LoginResType>>
}

/**
 * @description: 登录微信用户注册
 * @param {*} params
 * @return {*}
 */
export const wxlogin = async (params: WxLoginReqParams): Promise<Res<WxLoginResType>> => {
  return request('/member/wxMember/login', {
    method: 'POST',
    data: params
  }) as Promise<Res<WxLoginResType>>
}

/**
 * 测试接口
 */

export const count = async (): Promise<Res<Number>> => {
  return request('/member/member/count', {
    method: 'GET'
  }) as Promise<Res<Number>>
}
